﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/Site.Master" AutoEventWireup="true" CodeBehind="thong-tin-xe-ra-vao.aspx.cs" EnableEventValidation="false" Inherits="VanTaiTMS.Page.thong_tin_xe_ra_vao" %>
<%@ Register src="../SubPage/uc-danh-muc-xe.ascx" tagname="uc" tagprefix="uc1" %>
<%@ Register src="../SubPage/uc-nhan-vien.ascx" tagname="uc" tagprefix="uc2" %>
<%@ Register src="../SubPage/uc-nhom-xe.ascx" tagname="uc" tagprefix="uc3" %>
<%@ Register src="../SubPage/uc-noi-giao-hang.ascx" tagname="uc" tagprefix="uc4" %>
<%@ Register src="../SubPage/uc-loai-xe.ascx" tagname="uc" tagprefix="uc5" %>
<%@ Register src="../SubPage/uc-khach-hang.ascx" tagname="uc" tagprefix="uc6" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <!---Check-all----->
<script type="text/javascript">
    function checkAll(checkId) {
        $('.bordered tbody input').each(function () {
            if ($('input#chkAll').is(":checked")) {
                $(this).attr({ 'checked': 'checked' });
                $(this).parent().parent().css({ 'background': 'rgb(208, 233, 198)' });
            } else {
                $(this).attr({ 'checked': false });
                $(this).parent().parent().css({ 'background': '' });
            }
        })
    }
</script>
<!-------End------->

<!------Popup------>
<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#thongtinravaocuaxe').dialog({
            autoOpen: false,
            modal: true,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,
            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });          
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#duyetlenhdieudong').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,
            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#exporttoexcel').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,
            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#thongbao').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "372px",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });          
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#thongbaoxoa').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "372px",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });          
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#thongbaochoxera').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "372px",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#themnhanhsoxe').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#themnhanhtaixe').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        //setup new person dialog
        $('#themnhanhkhachhang').dialog({
            autoOpen: false,
            draggable: true,
            height: "auto",
            width: "auto",
            position: ['center', 50],
            resizable: false,

            create: function (event) { $(event.target).parent().css('position', 'fixed'); },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });
</script>
<!-------End------->

<!---AutoComplete-->
<script type="text/javascript">
    function pageLoad(sender, args) {
        $(document).ready((function () {
            var availableTags1 = [ <%= SuggestionList %>];

            $("#<%= txtSearch.ClientID %>").autocomplete({
                source: availableTags1
            });
        }));

        $(function () {
            $(".textboxngaynhap").datepicker({
                showOn: "button",
                buttonImage: "../images/calendar.gif",
                dateFormat: 'dd/mm/yy',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true
            }).val();
        });


        $(function () {
            $(".textboxfillter").datepicker({
                showOn: "button",
                buttonImage: "../images/calendar.gif",
                dateFormat: 'dd/mm/yy',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true
            }).val();
        });

        $(function ($) {
            $(".textboxngaynhap").mask("99/99/9999"); //Kiem tra ngay nhap
            $(".textboxsodienthoai").mask("(9999) 999-999");//Kiem tra so dien thoai
            $(".textboxsodienthoai11").mask("(99999) 999-999");//Kiem tra so dien thoai
        });

    //Check Row Hender Color
        $(document).ready(function () {
            $('.adminlist1 tr').click(function (event) {
                if (event.target.type !== 'checkbox') {
                    $(':checkbox', this).trigger('click');
                }
            });

            $("input[type='checkbox']").change(function (e) {
                if ($(this).is(":checked")) {
                    $(this).closest('tr').css("background", "Wheat");
                } else {
                    $(this).closest('tr').css("background", "");
                }
            });
        });
    }
</script>
<!-------End------->
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel ID="upDatePanelAll" runat="server">
<ContentTemplate>
    <div id="toolbar-1" class="yui3-toolbar">
        <asp:Panel id="panel1" runat="server" DefaultButton="cmdSerach" >
            <div class="div-search_A">
                <asp:Button ID="cmdAddNew" runat="server" CssClass="btn-add-new"  Text="" onclick="cmdAddNew_Click" />
                <asp:Button ID="cmdEdit" runat="server" CssClass="btn-add-edit"  Text="" onclick="cmdEdit_Click" />
                <asp:Button ID="cmdDel" OnClientClick="return confirmCheckIn(this);" runat="server" CssClass="btn-add-delete"  Text="" onclick="cmdDel_Click" />
            </div>

            <div class="div-search-texbox">
                <asp:TextBox ID="txtSearch" placeholder="Nhập vào từ khoá tìm kiếm..." CssClass="textbox_child_Search" runat="server"></asp:TextBox>      
            </div>

            <div class="div-search">
            <asp:Button ID="cmdSerach" runat="server" CssClass="btn-add-search" Text="" OnClick="cmdSerach_Click" />
            <asp:Button ID="cmdRefesh" runat="server" CssClass="btn-add-refesh"  Text="" onclick="cmdRefesh_Click" />
           

            <asp:Button ID="cmdDuyet" runat="server" CssClass="btn-add-review"  Text="" OnClick="cmdDuyet_Click" />
            <asp:Button ID="cmdExport" Visible="false" runat="server" CssClass="btn-add-excel"  Text=""  OnClick="cmdExport_Click" />
            </div>

            <div class="div-search-select">
                <asp:DropDownList ID="drTrangThai" CssClass="select-drop-child" runat="server" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="drTrangThai_SelectedIndexChanged">
                    <asp:ListItem Value="-1">--Vui lòng chọn trạng thái--</asp:ListItem>
                    <asp:ListItem Value="1">Được phép ra</asp:ListItem>
                    <asp:ListItem Value="0">Không được phép ra</asp:ListItem>
                </asp:DropDownList>
            </div>
        </asp:Panel>
    <div class="clr"></div>
    </div>
        
    <div id="toolbar-2" class="yui3-toolbar">
        <asp:Panel id="panel2" runat="server" DefaultButton="cmdFilter" >
            <div class="div-search-texbox-date-fillter">
                <asp:TextBox ID="txtTuNgayNgayNhapKho" placeholder="Từ ngày" CssClass="textboxngaynhap" Width="150px" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtDenNgayNhapKho" placeholder="Đến ngày ngày" CssClass="textboxngaynhap" Width="150px" runat="server"></asp:TextBox>
            </div>

            <div class="div-search_B">
                <asp:Button ID="cmdFilter" CssClass="btn-add-fillter" runat="server" ToolTip="Lọc" OnClick="cmdFilter_Click" />
            </div>
         </asp:Panel>
    <div class="clr"></div>
    </div>   
    <%=StrAlert%> 
    <!-----------Hiễn-Thị-Dữ-Liệu------------>
    <table  class="bordered">
        <thead>
            <tr>
                <th width="5%">STT</th>        
                <th width="5%">
                    <input type="checkbox" onclick="checkAll('chkList');" id="chkAll">
                </th>
                <th width="10%">Mã khách hàng</th>
                <th width="10%">Tên khách hàng</th>
                <th width="5%">Số xe</th>
                <th width="10%">Tài xế</th>
                <th width="10%">Container</th>
                <th width="10%">Ngày hiện tại</th>
                <th width="10%">Giờ vào</th>
                <th width="10%">Giờ ra</th>
                <th width="10%">Ghi chú</th>
                <th width="10%">Trạng thái xe</th>
            </tr>
        </thead>

        <tbody>
             <asp:ListView ID="ListViewAll" runat="server" ItemPlaceholderID="lstViewAll" DataKeyNames="STT" OnItemCommand="ListViewAll_ItemCommand" OnItemDataBound="ListViewAll_ItemDataBound">
                <ItemTemplate>
                    <tr runat="server" id="SetColor">
                        <td align="center" style="text-align:center">
                            <asp:Label ID="lb_lst_ID" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                        </td>

                        <td style="text-align:center">
                            <asp:CheckBox ID="chkList" onclick='highlight(this)' ClientIDMode="Static" runat="server" />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lbMa" runat="server" Text='<%# Eval("Customers_Alias") %>'></asp:Label>
                            <input type="hidden" id="hiddenId" value='<%# Eval("STT") %>' runat="server" name="hiddenId" />
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName" CommandName="Accept" runat="server"><%# Eval("Customers_Name")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_A" CommandName="Accept" runat="server"><%# Eval("Vehicle_Number")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_B" CommandName="Accept" runat="server"><%# Eval("FullNameMem")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_C" CommandName="Accept" runat="server"><%# Eval("Container")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_D" CommandName="Accept" runat="server"><%# Eval("DocumentDate","{0:dd/MM/yyyy}")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_E" CommandName="Accept" runat="server"><%# Eval("DateIn","{0:HH:mm:ss}")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_F" CommandName="Accept" runat="server"><%# Eval("DateOut","{0:HH:mm:ss}")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                           <asp:Label ID="Label4" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
                        </td>

                        <td align="center" style="text-align:center">
                           <asp:LinkButton ID="linkListName_G" CommandName="Accept" runat="server" Text='<%# Eval("Status")%>'></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <LayoutTemplate>
                    <asp:PlaceHolder runat="server" ID="lstViewAll"></asp:PlaceHolder>
                </LayoutTemplate>
             </asp:ListView>
        </tbody>
    </table>
    <!--------------Kêt-thúc----------------->

    <!-------------Phân-trang---------------->
    <table  class="bordered">
        <thead>
            <tr>
                <th class="pager">
                    <asp:DataPager ID="DataPagerListAll" runat="server" 
                        OnPreRender="DataPagerListAll_PreRender" PagedControlID="ListViewAll">
                        <Fields>
                            <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" PreviousPageText="&lt;" 
                                ShowFirstPageButton="True" ShowNextPageButton="False" />
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;" 
                                ShowLastPageButton="True" ShowPreviousPageButton="False" />
                        </Fields>
                    </asp:DataPager>
                </th>
            </tr>
        </thead>
    </table>
    <!--------------Kêt-thúc----------------->
</ContentTemplate>
</asp:UpdatePanel>

<!-------------Edit-Dữ-Liệu-------------->
<div id="thongtinravaocuaxe" title="Thông tin ra vào của xe">
    <asp:UpdatePanel ID="upNewUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div class="toolbar-ui-all-big">
                 <asp:ImageButton CssClass="button-all" ID="imgSave" ImageAlign="Middle" 
                    ImageUrl="~/Icon/save.png" runat="server" 
                    onclick="imgSave_Click" />

                 <asp:ImageButton CssClass="button-all" ID="imgrefesh" ImageAlign="Middle" 
                    ImageUrl="~/Icon/refesh-ui.png" ToolTip="Làm tươi" runat="server" 
                    onclick="imgrefesh_Click" />
            </div>
            <div class="clr"></div>
            <div class="ui-main">
                <div class="clr"></div>
                <div style="display: none">
                    <asp:Label ID="lbID" runat="server"></asp:Label>
                    <asp:Label ID="lbDatetime" runat="server" Text=""></asp:Label>
                </div>
                <div class="ui-box-text-box">
                    <label class="label">Mã khách hàng <span style="color:Red">(*)</span></label>
                    <asp:TextBox ID="txtMaKhachHang" CssClass="textbox" runat="server"></asp:TextBox>
                </div>

                <div class="ui-box-text-box">
                    <label class="label">
                        Chọn khách hàng <span style="color:Red">(*)</span>
                        <span style="text-align:right;color:blue">
                        <asp:LinkButton ID="linkThemNhanhKhachHang" runat="server" ToolTip="Thêm nhanh vào bảng nếu chưa có" OnClick="linkThemNhanhKhachHang_Click">[...]</asp:LinkButton>
                        </span>
                    </label>
                    <asp:DropDownList ID="drKhachHang" CssClass="select-drop" runat="server" AutoPostBack="true"
                        AppendDataBoundItems="True" OnSelectedIndexChanged="drKhachHang_SelectedIndexChanged">
                        <asp:ListItem Value="-1">--Vui lòng chọn khách hàng--</asp:ListItem>
                    </asp:DropDownList>
                </div>

                <div class="ui-box-text-box">
                    <label class="label">
                        Chọn số xe <span style="color:Red">(*)</span>
                        <span style="text-align:right;color:blue">
                        <asp:LinkButton ID="linkThemNhanhSoXe" runat="server" ToolTip="Thêm nhanh vào bảng nếu chưa có" OnClick="linkThemNhanhSoXe_Click">[...]</asp:LinkButton>
                        </span>
                    </label>
                    <asp:DropDownList ID="drSoXe" CssClass="select-drop" runat="server" AutoPostBack="true"
                        AppendDataBoundItems="True" OnSelectedIndexChanged="drSoXe_SelectedIndexChanged">
                        <asp:ListItem Value="-1">--Vui lòng chọn số xe--</asp:ListItem>
                    </asp:DropDownList>
                </div>

                <div class="clr"></div>

                <div class="ui-box-text-box">
                    <label class="label">
                        Chọn tài xế <span style="color:Red">(*)</span>
                        <span style="text-align:right;color:blue">
                        <asp:LinkButton ID="linkThemNhanhTaiXe" runat="server" ToolTip="Thêm nhanh vào bảng nếu chưa có" OnClick="linkThemNhanhTaiXe_Click">[...]</asp:LinkButton>
                        </span>
                    </label>
                    <asp:DropDownList ID="drTaiXe" CssClass="select-drop" runat="server" AutoPostBack="true"
                        AppendDataBoundItems="True" OnSelectedIndexChanged="drTaiXe_SelectedIndexChanged">
                        <asp:ListItem Value="-1">--Vui lòng chọn tài xế--</asp:ListItem>
                    </asp:DropDownList>
                </div>

                <div class="ui-box-text-box">
                    <label class="label">Container <span style="color:Red">(*)</span></label>
                    <asp:TextBox ID="txtContainer" CssClass="textbox" runat="server"></asp:TextBox>
                </div>
                                
                <div class="ui-box-text-box">
                    <label class="label">Ghi chú</label>
                    <asp:TextBox ID="txtGhiChu" TextMode="MultiLine" CssClass="textbox-muiti" runat="server"></asp:TextBox>
                </div>
            <div class="clr"></div>
            </div>
            <div class="clr"></div>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server"  AssociatedUpdatePanelID="upNewUpdatePanel">
                <ProgressTemplate>
                    <img alt='loadding' class="loading" src="../images/loading-fb.gif" /><br />
                    <div class="loading-label-right">
                        Đang xử lý dữ liệu...
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="imgSave" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->

<!-------------Thông-Bao-Xoá------------->
<div id="thongbaoxoa" title="Thông Báo">
    <asp:UpdatePanel ID="upDatePanelThongBaoXoa" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div style="display:none">
                <asp:Label ID="lbIDXoa" runat="server" Text=""></asp:Label>
                <asp:Label ID="lbTrangThaiDuyet" runat="server" Text=""></asp:Label>
            </div>
            <p>
                <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
                <asp:Label ID="lbThongBaoXoa" CssClass="error-msg" runat="server" Text=""></asp:Label>
            </p>
            <hr />
            <div class="toolbar-ui-footer">
                <asp:Button ID="cmdAgree" CssClass="btn btn-info" Height="29px" runat="server" 
                    Text="Đồng ý" onclick="cmdAgree_Click" />

                <asp:Button ID="cmdClose" CssClass="btn btn-info" Height="29px" runat="server" 
                    Text="Bỏ qua" onclick="cmdClose_Click" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->

<!-------------Cho-Xe-Ra------------->
<div id="thongbaochoxera" title="Thông Báo">
    <asp:UpdatePanel ID="upDatePanelChoXeRa" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div style="display:none">
                <asp:Label ID="lbRowID" runat="server" Text=""></asp:Label>
                <asp:Label ID="lbStatusID" runat="server" Text=""></asp:Label>
            </div>
            <p>
                <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
                <asp:Label ID="lbThongBaoDuyet" CssClass="error-msg" runat="server" Text=""></asp:Label>
            </p>
            <hr />
            <div class="toolbar-ui-footer">
                <asp:Button ID="cmdChoXeRa" CssClass="btn btn-info" Height="29px" runat="server" 
                    Text="Đồng ý" onclick="cmdChoXeRa_Click" />

                <asp:Button ID="cmdBoQuaChoXeRa" CssClass="btn btn-info" Height="29px" runat="server" 
                    Text="Bỏ qua" onclick="cmdBoQuaChoXeRa_Click" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->

<!-------------Thông-Bao----------------->
<div id="thongbao" title="Thông Báo">
    <asp:UpdatePanel ID="updatePanelThongBao" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <p>
                <span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
                <asp:Label ID="lbThongBaoLoi" CssClass="error-msg" runat="server" Text=""></asp:Label>
            </p>
            <hr />
            <div class="toolbar-ui-footer">
                <asp:Button ID="cmdCloseThongBao" CssClass="btn btn-info" Height="29px" runat="server" 
                    Text="Đóng lại" onclick="cmdCloseThongBao_Click" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->

<!-------------Thêm-Nhanh----------------->
<div id="themnhanhsoxe" title="Thêm nhanh">
     <asp:UpdatePanel ID="updatePanelThemNhanhSoXe" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
         <ContentTemplate>
             <uc1:uc ID="uc1" runat="server" />
         </ContentTemplate>
     </asp:UpdatePanel>
</div>

<div id="themnhanhtaixe" title="Thêm nhanh">
     <asp:UpdatePanel ID="updatePanelThemNhanhTaiXe" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
         <ContentTemplate>
             <uc2:uc ID="uc2" runat="server" />
         </ContentTemplate>
     </asp:UpdatePanel>
</div>

<div id="themnhanhkhachhang" title="Thêm nhanh">
     <asp:UpdatePanel ID="updatePanelThemNhanhKhachHang" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
         <ContentTemplate>
             <uc6:uc ID="uc3" runat="server" />
         </ContentTemplate>
     </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->
</asp:Content>
